<?php include $this->admin_tpl('meta');?>
<title>添加角色 - YzmCMS内容管理系统</title>
</head>
<body>
<article class="page-container">
<div class="formdoby_normal"> 
	<form method="post" onsubmit="return dosub(this)">
		<ul>
			 <li><label><span class="c-red">*</span>角色名称：</label>
			 	<input type="text" class="input" placeholder="角色名称" name="rolename" value="">
			 </li>
			 <li><label><span class="c-red">*</span>是否启用：</label>
			 <span class="span_input">
			 	<label class="label_radio"><input name="disabled" type="radio" value="0" checked> 启用</label>
			 	<label class="label_radio"><input name="disabled" type="radio" value="1" > 禁用</label>
			 </span>
			 </li>
			 <li><label>角色描述：</label>
			 	<span class="span_input"><textarea name="description" cols="" rows="" class="textarea  w_420"  placeholder="角色描述"></textarea></span>
			 </li>
		</ul>
		<div class="footer_btn">
			<input type="hidden" name="dosubmit" value="1">
			<input class="btn btn-primary radius" type="submit" value="提 交">
			<input class="btn btn-default radius" type="button" value="取 消" onclick="yzmcms_close()">	
		</div>
	</form>
</div>
</article>
<?php include $this->admin_tpl('footer');?>

<script type="text/javascript">
	function dosub(obj){
		 if(obj.rolename.value==''){
			 layer.msg('角色名称不能为空！', {icon:2});
			 return false;
		 }
        $.ajax({
            type: 'POST',
            url: '<?php echo U('add');?>', 
            data: $(obj).serialize(),
		    dataType: "json", 
            success: function (msg) {
				if(msg.status == 1){
					layer.msg(msg.message, {icon:1, time:800}, function(){
						parent.location.reload();
					});
			    }else{
					layer.msg(msg.message, {icon:2});
				}
            }
        })		 
		return false;			 
	}
</script> 

</body>
</html>